<template>
  <div class="custome-table">
    <el-form :disabled="detail">
      <div class="table-title">巡检维护记录表</div>
      <div class="custom-table">
        <table class="w18">
          <tr class="hide">
            <td /><td /><td /><td /><td /><td /><td /><td /><td /><td /><td /><td /><td /><td /><td /><td /><td /><td />
          </tr>
          <tr>
            <td colspan="9">
              <div class="table-row-item">
                <div class="item-label">设备名称</div><div class="item-value"><el-input v-model="form.key1" /></div>
              </div>
            </td>
            <td colspan="9">
              <div class="table-row-item">
                <div class="item-label">规格型号</div><div class="item-value"><el-input v-model="form.key2" /></div>
              </div>
            </td>
          </tr>
          <tr>
            <td colspan="9">
              <div class="table-row-item">
                <div class="item-label">设备编号</div><div class="item-value"><el-input v-model="form.key3" /></div>
              </div>
            </td>
            <td colspan="9">
              <div class="table-row-item">
                <div class="item-label">安装地点</div><div class="item-value"><el-input v-model="form.key4" /></div>
              </div>
            </td>
          </tr>
          <tr>
            <td colspan="9">
              <div class="table-row-item">
                <div class="item-label">企业名称</div><div class="item-value"><el-input v-model="form.key5" /></div>
              </div>
            </td>
            <td colspan="9">
              <div class="table-row-item">
                <div class="item-label">运行单位</div><div class="item-value"><el-input v-model="form.key6" /></div>
              </div>
            </td>
          </tr>
          <tr>
            <td colspan="18">
              <div class="table-row-item">
                <div class="item-label"><span style="margin-right: 5px;">运行维护内容</span><br>及处理说明</div><div class="item-value"><el-input v-model="form.key7" /></div>
              </div>
            </td>
          </tr>
          <tr>
            <td colspan="3" rowspan="2">项目</td>
            <td colspan="7" rowspan="2">内容</td>
            <td colspan="7">
              日期：<el-date-picker v-model="form.key8" type="date" placeholder="请选择日期" value-format="yyyy-MM-dd" />
            </td>
            <td rowspan="2" class="text-center">备注</td>
          </tr>
          <tr>
            <td>日</td><td>日</td><td>日</td><td>日</td>
            <td>日</td><td>日</td><td>日</td>
          </tr>
          <tr>
            <td colspan="3" rowspan="2">维护预备</td>
            <td colspan="7">查询日志a</td>
            <td><el-input v-model="form.key9" /></td>
            <td><el-input v-model="form.key10" /></td>
            <td><el-input v-model="form.key11" /></td>
            <td><el-input v-model="form.key12" /></td>
            <td><el-input v-model="form.key13" /></td>
            <td><el-input v-model="form.key14" /></td>
            <td><el-input v-model="form.key15" /></td>
            <td><el-input v-model="form.key16" /></td>
          </tr>
          <tr>
            <td colspan="7">检查耗材b</td>
            <td><el-input v-model="form.key17" /></td>
            <td><el-input v-model="form.key18" /></td>
            <td><el-input v-model="form.key19" /></td>
            <td><el-input v-model="form.key20" /></td>
            <td><el-input v-model="form.key21" /></td>
            <td><el-input v-model="form.key22" /></td>
            <td><el-input v-model="form.key23" /></td>
            <td><el-input v-model="form.key24" /></td>
          </tr>
          <tr>
            <td colspan="3" rowspan="6">辅助设备检查</td>
            <td colspan="7">站房卫生b</td>
            <td><el-input v-model="form.key25" /></td>
            <td><el-input v-model="form.key26" /></td>
            <td><el-input v-model="form.key27" /></td>
            <td><el-input v-model="form.key28" /></td>
            <td><el-input v-model="form.key29" /></td>
            <td><el-input v-model="form.key30" /></td>
            <td><el-input v-model="form.key31" /></td>
            <td><el-input v-model="form.key32" /></td>
          </tr>
          <tr>
            <td colspan="7">站房门窗的密封性检查b</td>
            <td><el-input v-model="form.key33" /></td>
            <td><el-input v-model="form.key34" /></td>
            <td><el-input v-model="form.key35" /></td>
            <td><el-input v-model="form.key36" /></td>
            <td><el-input v-model="form.key37" /></td>
            <td><el-input v-model="form.key38" /></td>
            <td><el-input v-model="form.key39" /></td>
            <td><el-input v-model="form.key40" /></td>
          </tr>
          <tr>
            <td colspan="7">供电系统（稳压电源、UPS等）b</td>

            <td><el-input v-model="form.key41" /></td>
            <td><el-input v-model="form.key42" /></td>
            <td><el-input v-model="form.key43" /></td>
            <td><el-input v-model="form.key44" /></td>
            <td><el-input v-model="form.key45" /></td>
            <td><el-input v-model="form.key46" /></td>
            <td><el-input v-model="form.key47" /></td>
            <td><el-input v-model="form.key48" /></td>
          </tr>
          <tr>
            <td colspan="7">室内温湿度a</td>
            <td><el-input v-model="form.key49" /></td>
            <td><el-input v-model="form.key50" /></td>
            <td><el-input v-model="form.key51" /></td>
            <td><el-input v-model="form.key52" /></td>
            <td><el-input v-model="form.key53" /></td>
            <td><el-input v-model="form.key54" /></td>
            <td><el-input v-model="form.key55" /></td>
            <td><el-input v-model="form.key56" /></td>
          </tr>
          <tr>
            <td colspan="7">空调b</td>
            <td><el-input v-model="form.key57" /></td>
            <td><el-input v-model="form.key58" /></td>
            <td><el-input v-model="form.key59" /></td>
            <td><el-input v-model="form.key60" /></td>
            <td><el-input v-model="form.key61" /></td>
            <td><el-input v-model="form.key62" /></td>
            <td><el-input v-model="form.key63" /></td>
            <td><el-input v-model="form.key64" /></td>
          </tr>
          <tr>
            <td colspan="7">自来水供应情况b</td>
            <td><el-input v-model="form.key65" /></td>
            <td><el-input v-model="form.key66" /></td>
            <td><el-input v-model="form.key67" /></td>
            <td><el-input v-model="form.key68" /></td>
            <td><el-input v-model="form.key69" /></td>
            <td><el-input v-model="form.key70" /></td>
            <td><el-input v-model="form.key71" /></td>
            <td><el-input v-model="form.key72" /></td>
          </tr>
          <!-- row -->
          <tr>
            <td colspan="3" rowspan="6">釆样系统检查</td>
            <td colspan="7">釆样泵釆水情况a</td>
            <td><el-input v-model="form.key73" /></td>
            <td><el-input v-model="form.key74" /></td>
            <td><el-input v-model="form.key75" /></td>
            <td><el-input v-model="form.key76" /></td>
            <td><el-input v-model="form.key77" /></td>
            <td><el-input v-model="form.key78" /></td>
            <td><el-input v-model="form.key79" /></td>
            <td><el-input v-model="form.key80" /></td>
          </tr>
          <tr>
            <td colspan="7">釆样管路通畅b</td>
            <td><el-input v-model="form.key81" /></td>
            <td><el-input v-model="form.key82" /></td>
            <td><el-input v-model="form.key83" /></td>
            <td><el-input v-model="form.key84" /></td>
            <td><el-input v-model="form.key85" /></td>
            <td><el-input v-model="form.key86" /></td>
            <td><el-input v-model="form.key87" /></td>
            <td><el-input v-model="form.key88" /></td>

          </tr>
          <tr>
            <td colspan="7">自动清洗装置运行情况b</td>
            <td><el-input v-model="form.key89" /></td>
            <td><el-input v-model="form.key90" /></td>
            <td><el-input v-model="form.key91" /></td>
            <td><el-input v-model="form.key92" /></td>
            <td><el-input v-model="form.key93" /></td>
            <td><el-input v-model="form.key94" /></td>
            <td><el-input v-model="form.key95" /></td>
            <td><el-input v-model="form.key96" /></td>
          </tr>
          <tr>
            <td colspan="7">排水管路通畅a</td>
            <td><el-input v-model="form.key97" /></td>
            <td><el-input v-model="form.key98" /></td>
            <td><el-input v-model="form.key99" /></td>
            <td><el-input v-model="form.key100" /></td>
            <td><el-input v-model="form.key101" /></td>
            <td><el-input v-model="form.key102" /></td>
            <td><el-input v-model="form.key103" /></td>
            <td><el-input v-model="form.key104" /></td>
          </tr>
          <tr>
            <td colspan="7">清洗釆样泵、过滤装置b</td>
            <td><el-input v-model="form.key105" /></td>
            <td><el-input v-model="form.key106" /></td>
            <td><el-input v-model="form.key107" /></td>
            <td><el-input v-model="form.key108" /></td>
            <td><el-input v-model="form.key109" /></td>
            <td><el-input v-model="form.key110" /></td>
            <td><el-input v-model="form.key111" /></td>
            <td><el-input v-model="form.key112" /></td>
          </tr>
          <tr>
            <td colspan="7">清洗釆样管路、排水管路b</td>
            <td><el-input v-model="form.key113" /></td>
            <td><el-input v-model="form.key114" /></td>
            <td><el-input v-model="form.key115" /></td>
            <td><el-input v-model="form.key116" /></td>
            <td><el-input v-model="form.key117" /></td>
            <td><el-input v-model="form.key118" /></td>
            <td><el-input v-model="form.key119" /></td>
            <td><el-input v-model="form.key120" /></td>
          </tr>
          <!-- row 在线监测仪器 开始112 8*16-->
          <tr v-for="(label,index) in cyqLabel" :key="'cyq_row_'+index">
            <td v-if="index === 0" colspan="3" :rowspan="cyqLabel.length">水污染源在线监测仪器</td>
            <td colspan="7">{{ label }}</td>
            <td><el-input v-model="form['key'+120+(index*8+1)]" /></td>
            <td><el-input v-model="form['key'+120+(index*8+2)]" /></td>
            <td><el-input v-model="form['key'+120+(index*8+3)]" /></td>
            <td><el-input v-model="form['key'+120+(index*8+4)]" /></td>
            <td><el-input v-model="form['key'+120+(index*8+5)]" /></td>
            <td><el-input v-model="form['key'+120+(index*8+6)]" /></td>
            <td><el-input v-model="form['key'+120+(index*8+7)]" /></td>
            <td><el-input v-model="form['key'+120+(index*8+8)]" /></td>
          </tr>
          <!-- row 在线监测仪器 开始249 8*6=48-->
          <tr v-for="(label,index) in csxtLabel" :key="'csxt_row_'+index">
            <td v-if="index === 0" colspan="3" :rowspan="csxtLabel.length">数据釆集传输系统</td>
            <td colspan="7">{{ label }}</td>
            <td><el-input v-model="form['key'+248+(index*8+1)]" /></td>
            <td><el-input v-model="form['key'+248+(index*8+2)]" /></td>
            <td><el-input v-model="form['key'+248+(index*8+3)]" /></td>
            <td><el-input v-model="form['key'+248+(index*8+4)]" /></td>
            <td><el-input v-model="form['key'+248+(index*8+5)]" /></td>
            <td><el-input v-model="form['key'+248+(index*8+6)]" /></td>
            <td><el-input v-model="form['key'+248+(index*8+7)]" /></td>
            <td><el-input v-model="form['key'+248+(index*8+8)]" /></td>
          </tr>
          <tr>
            <td colspan="3" class="text-center">巡检人员签字</td>
            <td colspan="15"><el-input v-model="form.key297" type="textarea" /></td>
          </tr>
          <tr>
            <td colspan="3" class="text-center">异常情况处理记录</td>
            <td colspan="15"><el-input v-model="form.key298" type="textarea" /></td>
          </tr>
          <tr>
            <td colspan="3" class="text-center">本周巡检情况小结</td>
            <td colspan="7"><el-input v-model="form.key299" type="textarea" /></td>
            <td colspan="4">
              （业主确认）：<el-input v-model="form.key300" type="textarea" />
            </td>
            <td colspan="4">
              日期：<el-date-picker v-model="form.key301" type="date" placeholder="请选择日期" value-format="yyyy-MM-dd" />
            </td>
          </tr>
          <tr>
            <td colspan="18" style="padding-left: 10px;">
              <div>正常请打“√；不正常请打“X”并及时处理并做相应记录；未检查则不用标识。 </div>
              <div>a为每天需要检查的；</div>
              <div>b为每7天至少进行一次的维护；</div>
              <div>c每30天至少进行一次的维护；</div>
              <div>d每季度至少进行一次的维护。</div>
            </td>
          </tr>
        </table>
        <table style="margin-top: 20px;">
          <tr>
            <td width="150">上传文件：图片</td>
            <td colspan="6"><TableUpLoadFile ref="tableUploadFile" :files-list="filePath" :detail="detail" /></td>
          </tr><tr>
            <td width="150">上传文件：视频</td>
            <td colspan="6"><TableUpLoadVideo ref="tableUploadVideo" :video-list="videoPath" :detail="detail" /></td>
          </tr>
        </table>
      </div>
    </el-form>

  </div>
</template>

<script>
import { getDict } from '@/utils/dict'
import { fileUrl, staticImgUrl } from '@/url'
import TableUpLoadFile from './../TableUpLoadFile'
import TableUpLoadVideo from './../TableUpLoadVideo'
export default {
  name: 'Xj',
  components: {
    TableUpLoadFile,
    TableUpLoadVideo
  },
  props: {
    obj: {
      type: Object,
      default: null
    },
    maintenaIndex: {
      type: Number,
      default: 0
    },
    detail: {
      type: Boolean,
      default: false
    }
  },
  data() {
    return {
      imagePreview: false,
      videoLoadingFlag: false,
      imgLoadingFlag: false,
      typeList: [],
      fileUrl, staticImgUrl,
      yesNoList: [
        { value: '是', label: '是' },
        { value: '否', label: '否' }
      ],
      // 显示的图片数据
      filePath: [],
      showVideoPath: [],
      videoPath: [],
      form: {
        key1: '', enterpriseName: '', outletName: '',
        key2: '', key3: '', key4: '', key5: '', key6: '', key7: '', key8: '', key9: '', key10: '', key11: '', key12: '', key13: '', key14: '', key15: '', key16: '', key17: '', key18: '', key19: '', key20: '', key21: '', key22: '', key23: '', key24: '', key25: '', key26: '', key27: '', key28: '', key29: '', key30: '', key31: '', key32: '', key33: '', key34: '', key35: '', key36: '', key37: '', key38: '', key39: '', key40: '', key41: '', key42: '', key43: '', key44: '', key45: '', key46: '', key47: '', key48: '', key49: '', key50: '', key51: '', key52: '', key53: '', key54: '', key55: '', key56: '', key57: '', key58: '', key59: '', key60: '', key61: '', key62: '', key63: '', key64: '', key65: '', key66: '', key67: '', key68: '', key69: '', key70: '', key71: '', key72: '', key73: '', key74: '', key75: '', key76: '', key77: '', key78: '', key79: '', key80: '', key81: '', key82: '', key83: '', key84: '', key85: '', key86: '', key87: '', key88: '', key89: '', key90: '', key91: '', key92: '', key93: '', key94: '', key95: '', key96: '', key97: '', key98: '', key99: '', key100: '', key101: '', key102: '', key103: '', key104: '', key105: '', key106: '', key107: '', key108: '', key109: '', key110: '', key111: '', key112: '', key113: '', key114: '', key115: '', key116: '', key117: '', key118: '', key119: '', key120: '', key121: '', key122: '', key123: '', key124: '', key125: '', key126: '', key127: '', key128: '', key129: '', key130: '', key131: '', key132: '', key133: '', key134: '', key135: '', key136: '', key137: '', key138: '', key139: '', key140: '', key141: '', key142: '', key143: '', key144: '', key145: '', key146: '', key147: '', key148: '', key149: '', key150: '', key151: '', key152: '', key153: '', key154: '', key155: '', key156: '', key157: '', key158: '', key159: '', key160: '', key161: '', key162: '', key163: '', key164: '', key165: '', key166: '', key167: '', key168: '', key169: '', key170: '', key171: '', key172: '', key173: '', key174: '', key175: '', key176: '', key177: '', key178: '', key179: '', key180: '', key181: '', key182: '', key183: '', key184: '', key185: '', key186: '', key187: '', key188: '', key189: '', key190: '', key191: '', key192: '', key193: '', key194: '', key195: '', key196: '', key197: '', key198: '', key199: '', key200: '', key201: '', key202: '', key203: '', key204: '', key205: '', key206: '', key207: '', key208: '', key209: '', key210: '', key211: '', key212: '', key213: '', key214: '', key215: '', key216: '', key217: '', key218: '', key219: '', key220: '', key221: '', key222: '', key223: '', key224: '', key225: '', key226: '', key227: '', key228: '', key229: '', key230: '', key231: '', key232: '', key233: '', key234: '', key235: '', key236: '', key237: '', key238: '', key239: '', key240: '', key241: '', key242: '', key243: '', key244: '', key245: '', key246: '', key247: '', key248: '', key249: ''

      },
      cyqLabel: [
        '仪器报警状态a', '仪器状态参数检查a', '仪器外观检查a', '仪器内部管路通畅b',
        '仪器进样、排液管路清洁检查b', '检查电极标准液、内充液b', '清洗电极头b',
        '标准溶液、试剂是否在保质期b', '更换标准溶液、清洗液、试剂b', '检查泵、管、加热炉等',
        '检查电极是否钝化，必要时进行更换', '检查超声波流量计高度是否发生变化', '仪器管路进行保养、清洁',
        '检查采样部分、计量单元、反应单元、加热单元、检测单元的工作情况',
        '根据水污染源在线监测仪器操作维护说明，检查及更换易损耗件，检查关键零部 件可靠性，如计量单元准确性、反应室密封性等，必要时进行更换',
        '校验d'
      ],
      csxtLabel: [
        '数据釆集系统报警信息a', '数据上传情况a', '数据釆集情况a',
        '检查数釆仪和仪器的连接b', '检查上传数据和现场数据的一致性b', '数据釆集、传输设备电源b'
      ]

    }
  },
  mounted() {
    this.init()
    this.typeList = getDict('e015')
    // const infoStr = this.$store.getters.user.info
    // if (infoStr) {
    //   const info = JSON.parse(infoStr)
    //   this.form.key6 = info.realName
    // }
  },
  methods: {
    init() {
      debugger
      if (this.obj.list) {
        const maintenaData = this.obj.list[this.maintenaIndex]
        if (maintenaData.filePath) {
          this.filePath = JSON.parse(maintenaData.filePath)
          this.$refs['tableUploadFile'].init(this.filePath)
        }
        if (maintenaData.videoPath) {
          this.videoPath = JSON.parse(maintenaData.videoPath)
        }
        if (maintenaData.formContent) {
          this.form = JSON.parse(maintenaData.formContent)
        }
        this.form.enterpriseName = this.obj.enterpriseName
        this.form.outletName = this.obj.outletName
      }
      // 默认值填充
      if (this.obj.lastMaintenance) {
        var lastMaintenance = JSON.parse(this.obj.lastMaintenance.formContent)
        this.form.key1 = lastMaintenance.key1
        this.form.key2 = lastMaintenance.key2
        this.form.key3 = lastMaintenance.key3
        this.form.key4 = lastMaintenance.key4
        this.form.key5 = lastMaintenance.key5
        this.form.key6 = lastMaintenance.key6
        this.form.key7 = lastMaintenance.key7
      }
    },
    getFormData() {
      return {
        formContent: JSON.stringify(this.form),
        filePath: this.$refs.tableUploadFile ? this.$refs.tableUploadFile.getPaths() : [],
        videoPath: this.$refs.tableUploadVideo ? this.$refs.tableUploadVideo.getPaths() : [],
        maintenaIndex: this.maintenaIndex
      }
    },
    clearData() {
      this.form = {
        key1: '', enterpriseName: '', outletName: '',
        key4: null, key5: '', key6: '',
        key7: '', key8: '', key9: '',
        key10: '', key11: '', key12: '', key13: '', key14: '', key15: '', key16: '', key17: '',
        key18: '', key19: '', key20: '', key21: '', key22: '', key23: '', key24: ''
      }
    }
  }
}
</script>

<style lang="scss" scoped>

</style>
